<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('登录')"/>
    <style type="text/css">
        body {
            background-color: #f2f2f2;
        }

        .layadmin-user-login {
            position: relative;
            left: 0;
            top: 0;
            padding: 110px 0;
            min-height: 100%;
            box-sizing: border-box;
        }

        .layadmin-user-login-main {
            width: 375px;
            margin: 0 auto;
            box-sizing: border-box;
        }

        .layadmin-user-login-header {
            text-align: center;
        }

        .layadmin-user-login-header h2 {
            margin-bottom: 10px;
            font-weight: 300;
            font-size: 30px;
            color: #000;
        }

        .layadmin-user-login-box {
            padding: 20px;
        }

        .layadmin-user-login-body .layui-form-item {
            position: relative;
        }

        .layadmin-user-login-icon {
            position: absolute;
            left: 1px;
            top: 1px;
            width: 38px;
            line-height: 36px;
            text-align: center;
            color: #d2d2d2;
        }

        .layui-icon {
            font-family: layui-icon !important;
            font-size: 16px;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
        }

        .layadmin-user-login-body .layui-form-item .layui-input {
            padding-left: 38px;
        }

        .layui-input, .layui-textarea {
            display: block;
            width: 100%;
        }
    </style>
</head>
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login">
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>春藤医疗管理系统</h2>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                        <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img th:onclick="this.src='/kaptcha/generateKaptcha?d='+new Date()*1" th:src="@{/kaptcha/generateKaptcha}" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode" style="cursor: pointer;">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" style="margin-bottom: 20px;">
                <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary"><span>记住密码</span><i class="layui-icon layui-icon-ok"></i></div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="LAY-user-login-submit">登 入</button>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var msg = [[${msg}]];
    if (msg != null && msg != '') {
        $.modal.alert(msg);
    }



    layui.use(['form'], function () {
        var form = layui.form;

        form.on('submit()', function (data) {
            console.log(data.field);
            $.operate.post(ctx + "doLogin", data.field, function (result) {
                if (result.code == web_status.SUCCESS) {
                    window.location.href = ctx;
                } else {
                    $("#LAY-user-login-vercode").val("");
                    $("#LAY-user-get-vercode").click();
                    $.modal.alert(result.msg, result.code);
                }
            });
            return false;
        });
    });
</script>
</body>
</html>